static unsigned int __initdata opt_dom0_max_vcpus;
integer_param("dom0_max_vcpus", opt_dom0_max_vcpus);
-static int dom0_11_mapping = 1;
+int dom0_11_mapping = 1;
#define DOM0_MEM_DEFAULT 0x8000000 /* 128 MiB */
static u64 __initdata dom0_mem = DOM0_MEM_DEFAULT;
#include <xsm/xsm.h>
#include <xen/trace.h>
+#ifndef is_domain_direct_mapped
+# define is_domain_direct_mapped(d) ((void)(d), 0)
+#endif
+
struct memop_args {
/* INPUT */
struct domain *domain; /* Domain to be affected. */
}
else
{
- page = alloc_domheap_pages(d, a->extent_order, a->memflags);
+ if ( is_domain_direct_mapped(d) )
+ {
+ mfn = gpfn;
+ if ( !mfn_valid(mfn) )
+ {
+ gdprintk(XENLOG_INFO, "Invalid mfn %#"PRI_xen_pfn"\n",
+ mfn);
+ goto out;
+ }
+
+ page = mfn_to_page(mfn);
+ if ( !get_page(page, d) )
+ {
+ gdprintk(XENLOG_INFO,
+ "mfn %#"PRI_xen_pfn" doesn't belong to the"
+ " domain\n", mfn);
+ goto out;
+ }
+ put_page(page);
+ }
+ else
+ page = alloc_domheap_pages(d, a->extent_order, a->memflags);
+
if ( unlikely(page == NULL) )
{
if ( !opt_tmem || (a->extent_order != 0) )
&& p2m_pod_decrease_reservation(a->domain, gmfn, a->extent_order) )
continue;
+ /* With the lack for iommu on some ARM platform, domain with DMA-capable
+ * device must retrieve the same pfn when the hypercall
+ * populate_physmap is called.
+ */
+ if ( is_domain_direct_mapped(a->domain) )
+ continue;
+
for ( j = 0; j < (1 << a->extent_order); j++ )
if ( !guest_remove_page(a->domain, gmfn + j) )
goto out;